home *** CD-ROM | disk | FTP | other *** search
/ Sacred & Secular / Sacred and Secular.iso / pc / movies / shared.dir / 05031_Script_5031 < prev    next >
Text File  |  1996-04-03  |  5KB  |  171 lines

  1. global datafirstline,findlist
  2.  
  3. --on findnext thetext,wherenow
  4. --  put findall(thetext) into theplaces
  5. --  sort theplaces
  6. --  if the number of words in theplaces = 0 then return ""
  7. --  put findposnear(theplaces,value(wherenow)+1) into theplace
  8. --  if theplace = count(theplaces) then
  9. --    return getat(theplaces,1)
  10. --  else
  11. --    return getat(theplaces,theplace+1)
  12. --  end if
  13. --end
  14.  
  15. --on findprev thetext,wherenow
  16. --  put findall(thetext) into theplaces
  17. --  sort theplaces
  18. --  if the number of words in theplaces = 0 then return ""
  19. --  put findposnear(theplaces,value(wherenow)) into theplace
  20. --  if theplace = 0 then
  21. --    return getat(theplaces,(count(theplaces)))
  22. --  else
  23. --    return getat(theplaces,theplace)
  24. --  end if
  25. --end
  26.  
  27. on findall thetext
  28.   cursor 4
  29.   put false into somethingmissing
  30.   put the number of words in thetext into wordcount
  31.   set p = []
  32.   repeat with a = 1 to the number of words in thetext
  33.     put wordplaces(word a of thetext) into wp
  34.     if wp = "" then
  35.       put true into somethingmissing
  36.       exit repeat
  37.     end if
  38.     repeat with w = 1 to the number of items in wp
  39.       append(p,value(item w of wp))
  40.     end repeat
  41.   end repeat
  42.   set np = []
  43.   if somethingmissing = true then
  44.     cursor -1
  45.     return np
  46.   end if
  47.   append(p,100000000000)
  48.   sort p
  49.   if wordcount > 1 then
  50.     put count(p)-1 into c
  51.     repeat with a = 1 to c
  52.       put 0 into match
  53.       put getat(p,a) into thisone
  54.       repeat with w = 1 to wordcount-1
  55.         if a+w > c then exit repeat
  56.         if getat(p,a+w) = thisone then
  57.           put match + 1 into match
  58.         else
  59.           exit repeat
  60.         end if
  61.       end repeat
  62.       if match >= wordcount-1 then append(np,thisone)
  63.     end repeat
  64.     cursor -1
  65.     return np
  66.   else
  67.     deleteat(p,count(p))
  68.     cursor -1
  69.     return p
  70.   end if
  71.   cursor -1
  72. end
  73.  
  74. on wordplaces theword
  75.   put char 1 of theword & "words" into thecast
  76.   if the number of cast thecast < 1 then return ""
  77.   put offset(return&theword&",",return & field thecast) into theoffset
  78.   if theoffset = 0 then return ""
  79.   put line(the number of lines in char 1 to theoffset of field thecast) of field thecast into theline
  80.   delete item 1 of theline
  81.   return theline
  82. end
  83.  
  84. on finddescription theplaces
  85.   cursor 4
  86.   set finddescriptions = ""
  87.   repeat with a = 1 to count(theplaces)
  88.     put line (getat(theplaces,a)) of field "Find descriptions" into line a of finddescriptions
  89.   end repeat
  90.   cursor -1
  91.   return finddescriptions
  92. end
  93.  
  94. -- *** lisa's code
  95. on searchfortext
  96.   global gFindAllResults -- DMD added
  97.   cursor 4
  98.   set the castnum of sprite 7 = 126 -- the number of cast "retLIT" 
  99.   updatestage
  100.   set datafirstline = 1
  101.   put the text of field 4786 into temptext -- cast "ENTERTEXT"
  102.   --DMD put finddescription (findall (temptext)) into hold
  103.   set gFindAllResults = findall (temptext) 
  104.   put finddescription (gFindAllResults) into hold
  105.   put hold into field 4787 -- cast "DATA"
  106.   PUT LINE datafirstline TO (datafirstline + 4) OF field 4787 into cast 4788 
  107.   -- FIELD "DATA" INTO CAST "DATA2"
  108.   put RETURN after field 4788 -- field "DATA2"
  109.   
  110.   set the castnum of sprite 7 = 125 -- the number of cast "ret"
  111.   UPDATESTAGE
  112.   cursor -1
  113. end searchfortext
  114.  
  115. --keydownscript
  116. on findfeature
  117.   if the key = RETURN then
  118.     --if the frame > 266 and the frame < 280 then
  119.     if the visible of sprite 4 = true then
  120.       searchfortext
  121.       exit  
  122.     end if
  123.     --  end if  
  124.   else
  125.     checkKeys  
  126.   end if
  127.   
  128. end
  129.  
  130. on gotoframe mline
  131.   global gFindAllResults
  132.   
  133.   if mLine < 1 then set mLine = 1
  134.   if mLine = 6 then set mLine = 5
  135.   
  136.   put ">>>gotoFrame " & mLine
  137.   
  138.   cursor -4
  139.   repeat with i = 4 to 8
  140.     set the visible of sprite i to false
  141.   end repeat
  142.   
  143.   set the visible of sprite 22 to false
  144.   --  set temptext = the text of field "ENTERTEXT"
  145.   --  set templist = findall(temptext)
  146.   
  147.   -- DMD
  148.   
  149.   set templist = gFindAllResults
  150.   set error = 0
  151.   
  152.   if voidP(tempList) then set error = 1
  153.   else if count(tempList) = 0 or (mline + datafirstline - 1) > count(tempList) then set error = 1
  154.   
  155.   if error then
  156.     beep
  157.     exit
  158.   end if
  159.   
  160.   set mline = (mline + datafirstline) -1
  161.   set templistno = getat(templist,mline)
  162.   set framename = getat(findlist,templistno)
  163.   put ">>>goToFrame " & frameName
  164.   go framename
  165.   --  set the text of cast "ENTERTEXT" to ""
  166.   --  set the text of cast "DATA" to "" 
  167.   --  set the text of cast "DATA2" to "" 
  168.   cursor -1
  169.   
  170. end gotoframe
  171.